home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_03_06
/
3n06057a
< prev
next >
Wrap
Text File
|
1992-02-02
|
444b
|
23 lines
Listing 4
/*
* arraycmp.h - a general-purpose array comparer in C++
* using compile-time genericity
*/
#define arraycmp_declare(T) \
int arraycmp(const T a1[], const T a2[], size_t n)
#define arraycmp_implement(T) \
arraycmp_declare(T) \
{ \
size_t i; \
int cmp; \
\
for (i = 0; i < n; ++i) \
if ((cmp = T ## cf(a1[i], a2[i])) != 0) \
return cmp; \
return 0; \
}